home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
comms
/
other
/
ums
/
rexx
/
writemessage.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1999-06-14
|
3KB
|
128 lines
/* ------------------------------------------------------------------------
:Program. WriteMessage.rexx
:Contents. writes a new message to UMS' messagebase
:Author. Kai Bolay [kai]
:Address. Hoffmannstraße 168
:Address. D-71229 Leonberg
:EMail. kai@studbox.uni-stuttgart.de
:Version. $VER: WriteMessage.rexx 2.3 (11.11.95)
:Copyright. Public Domain
:Language. ARexx
:Translator. RexxMast
$Id: WriteMessage.rexx 2.3 1995/11/11 12:09:01 kai Exp $
$Log: WriteMessage.rexx $
# Revision 2.3 1995/11/11 12:09:01 kai
# started RCS. Old history:
# v1.0 [kai] 23-Sep-93
# v1.1 [hG] 16-Jan-94 added argument passing
# v1.2 [hG] 23-Jan-94 uses UMSInit.rexx 1.1 and
# hgRexxSupport.library
# v2.0 [kai] 21-Dec-94 adapted to UMS v11
# v2.1 [kai] 13-May-95 added support for FILE
# v2.2 [kai] 04-Oct-95 beautified
# v2.3 [kai] 11-Nov-95 adapted to newest standard
#
------------------------------------------------------------------------ */
options results
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on ERROR
signal on HALT
signal on IOERR
signal on SYNTAX
/*** Init ***/
call addlib("rexxdossupport.library", 0, -30)
call addlib("ums.library", 0, -210, 11)
call UMSInitConsts()
/*** Arguments ***/
parse SOURCE . " " . " " ProgramName .
ArgsTemplate = "NAME/A,PASSWORD,SERVER/K,TONAME/A,TOADDR,SUBJECT,FILE/A";
args.SERVER = ""
args.PASSWORD = ""
args.TOADDR = ""
args.SUBJECT = "no subject"
parse arg arguments
if strip(arguments) = '?' then do
call writech(STDOUT, ArgsTemplate || ': ')
arguments = readln(STDIN)
end; else nop
if ~ReadArgs(arguments,ArgsTemplate,"args.") then do
say Fault(RC, ProgramName)
exit 10
end; else nop
/*** Login ***/
account = UMSLogin(args.name, args.password, args.server)
if account = 0 then do
say "unable to login."
exit 10
end
/*** Do the magic ***/
drop msg.
msg.UMSCODE_MsgText_FILE = args.file
msg.UMSCODE_ToName = args.toname
msg.UMSCODE_ToAddr = args.toaddr
msg.UMSCODE_Subject = args.subject
msg.UMSCODE_ReplyName = "root"
num = UMSWriteMsg(account, msg.)
if num = 0 then do
call CheckErr
RC = 20; call LOGOUT
end; else do
say "The new message got #" || num
end
/*** Final cleanup ***/
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
RC = 0
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
SAY "Error: " rc errortext(rc) "Line" sigl
RC = 20
END
/*** Logout ***/
LOGOUT:
if account ~= 0 then do
call UMSLogout(account)
account = 0
end
exit RC
/*** Support ***/
CheckErr: procedure expose account
err = UMSErrNum(account)
if err ~= 0 then do
say "UMS Error #" || err || ": " || UMSErrTxt(account)
end
return